home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 784 b | 39 lines | [TEXT/CWIE] |
- // FinitePoolBase.h
-
- #ifndef FinitePoolBase_h
- #define FinitePoolBase_h
-
- #ifndef BitArrayBase_h
- #include "BitArrayBase.h"
- #endif
-
- class FinitePoolBase
- {
- private:
- uint8 *const space;
- BitArrayBase& map;
- const uint32 elementSize;
- uint32 allocated;
- uint32 nextAllocation;
-
- // not implemented:
- FinitePoolBase( const FinitePoolBase& );
- void operator=( const FinitePoolBase& );
-
- public:
- FinitePoolBase( void *theSpace,
- BitArrayBase& theMap,
- uint32 elementSize );
-
- bool Full() const { return allocated < map.Length(); }
- bool IsEmpty() const { return allocated == 0; }
-
- void *Allocate( uint32 size );
- void Release( void * );
- };
-
- inline void *operator new( uint32 size, FinitePoolBase& pool )
- { return pool.Allocate( size ); }
-
- #endif
-